<?php 
require_once("nav.php");
$sql = 'select t1.*,t2.typename from videos t1 left join videotype t2 on t1.tid=t2.tid';
$result = fetch_array($sql);
?>
    <div class="col-sm-9 col-md-10">
          <h1 class="text-center">视频列表</h1>
          <table class="table table-hover"> 
           <tr>
             <th>序号</th>
             <th>视频名称</th>
             <th>视频类型</th>
             <th>海报</th>
             <th>内容简介</th>
             <th>添加日期</th>
             <th>上传用户</th>
             <th>点击率</th>
             <th>下载量</th>
             <th>下载地址</th>
           </tr>
           <?php 
              foreach ($result as $row) {
               echo '<tr>';
               echo '<td>'.$row['vid'].'</td>';
               echo '<td>'.$row['videoname'].'</td>'; 
               if($row['tid']==1)
              {
                $row['tid']='电视剧';
              }
              if($row['tid']==2)
              {
                $row['tid']='电影';
              }
              if($row['tid']==3)
              {
                $row['tid']='动画片';
              }
              if($row['tid']==4)
              {
                $row['tid']='体育';
              }
              if($row['tid']==5)
              {
                $row['tid']='原创';
              }
              if($row['tid']==6)
              {
                $row['tid']='综艺';
              }

               echo '<td>'.$row['tid'].'</td>';
               echo '<td align="center"><img src='.UserPhotoPath.$row['pic'].' width=60 height=80 alt="无头像"></td>'; 
               echo '<td>'.$row['intro'].'</td>';
               echo '<td>'.$row['uploaddate'].'</td>';
               echo '<td>'.$row['uploadadmin'].'</td>';
               echo '<td>'.$row['hittimes'].'</td>';
               echo '<td>'.$row['downtimes'].'</td>';
               echo '<td>'.$row['address'].'</td>';
               
               echo '<td><a href="video-EditForm.php?id='.$row['vid'].' ">修改</a> | 
               <a href="videoDelete.php?id='.$row['vid'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a></td>';
               echo '</tr>';  
              }
              echo '</table>';  
              $totalrows = count($result);
              echo "<table align='center'><tr><td>共有{$totalrows}条记录</td></tr></table>";  
            ?>
            </table>

    </div>
           </div>
           </div>
<?php 
require_once('footer.php');
 ?>